//
//  DUMaskView.swift
//  SimpleCal
//
//  Created by 杜晓祥 on 2021/11/23.
//

import Cocoa

class DUMaskBack: NSView {
    
    override init(frame frameRect: NSRect) {
        super.init(frame: frameRect)
        initialize()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        initialize()
    }

    private func initialize () {
        self.alphaValue = 0.5
        self.wantsLayer = true
    }
    
    override func layout() {
        self.layer?.backgroundColor = NSColor.lightGray.cgColor
    }
    override var isOpaque: Bool {
        return true
    }
    
    override var mouseDownCanMoveWindow: Bool {
        return false
    }
//    override func viewWillMove(toSuperview newSuperview: NSView?) {
//        super.viewWillMove(toSuperview: newSuperview)
//    
//        NSEvent.addLocalMonitorForEvents(matching: [.any]) { event in
//            if self.frame.contains(event.locationInWindow) {
//                return nil
//            }
//            return event
//        }
//        
//    }
}
